package com.have.blog.picture.service;

import com.have.blog.base.wrapper.Wrapper;
import com.have.blog.config.configs.feign.FeignConfiguration;
import com.have.blog.model.models.Picture;
import com.have.blog.picture.service.hystrix.PictureFeignHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

@FeignClient(name = "blog-picture", configuration = FeignConfiguration.class, fallback = PictureFeignHystrix.class)
public interface PictureFeignApi {

    @PostMapping(value = "/picture/cropperPicture")
    Wrapper cropperPicture(@RequestParam("file") MultipartFile file);
    /**
     * 获取图片的接口
     * @param pictureUid 图片UID
     * @return
     */
    @GetMapping(value = "/picture/getPicture")
    Wrapper<String> getPictureUrl(@RequestParam("pictureUid") Integer pictureUid);

    /**
     * 批量获取图片的结构
     */
    @GetMapping(value = "/picture/getPictures")
    Wrapper<Map<Integer, String>> getPicturesUrl(@RequestParam("pictureUids") List<Integer> pictureUids);


    @PostMapping("/picture/pictures")
    Wrapper<List<Picture>> uploadPics(List<MultipartFile> filedatas);
}
